package com.attilax.spri;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@Configuration
@EnableWebMvc
//扫描控制器
/**
 * like mvc.xml
 * @author Administrator
 *type=FilterType.ANNOTATION,
 */
@ComponentScan(includeFilters=@ComponentScan.Filter(value=Controller.class))
public class SpringMvcConf extends WebMvcConfigurationSupport {
	public static void main(String[] args) {
		System.out.println("--");
	}
 //配置视图解析器
 //html解析
 //@    mmmBean
// public ViewResolver htmlResolver(){
//   InternalResourceViewResolver viewResolver=new InternalResourceViewResolver();
//   viewResolver.setPrefix("/WEB-INF/view/");
//   viewResolver.setSuffix(".html");
//   return viewResolver;
// }
 //静态资源处理
 //当DisptacherServlet接收到了他匹配的请求，但是找不到相应的Controller，就会把这个请求返回给默认的处理（比如交给tomcat处理）
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
  configurer.enable();
}
}